<div class="dux-page-header am-cf">
    <div class="page-title">
        <a class="am-btn am-btn-primary" href="{url('index')}"> 规则列表</a>
    </div>
    <div class="page-action">
        <a class="am-btn am-btn-danger" href="javascript:location.reload();"><i class="am-icon-refresh"></i></a>
    </div>
</div>

<div class="dux-body">
    <div class="am-panel am-panel-default dux-panel">
        <div class="am-panel-hd">{$assignName}规则</div>
        <div class="am-panel-bd">
            <form class="am-form  am-form-horizontal dux-form" data-dux="form-bind" method="post">
                <fieldset>
                    <div class="am-form-group">
                        <label class="am-u-md-2 am-u-sm-12 am-form-label">规则名称</label>
                        <div class="am-u-md-10 am-u-sm-12">
                            <input type="text" name="name" value="{$info.name}" placeholder="请输入规则名称" required>
                        </div>
                    </div>

                    <div class="am-form-group">
                        <label class="am-u-md-2 am-u-sm-12 am-form-label">优先级</label>
                        <div class="am-u-md-10 am-u-sm-12">
                            <input type="number" name="priority" value="{$info.priority ? $info.priority : 0}">
                            <div class="am-form-help">优先级越高越容易触发</div>
                        </div>
                    </div>


                    <div class="am-form-group">
                        <label class="am-u-md-2 am-u-sm-12 am-form-label">触发关键词</label>
                        <div class="am-u-md-10 am-u-sm-12">
                            <input type="text" name="keywords" value="{$info.keywords}" placeholder="多个规格请用,分割" data-dux="form-tags">
                        </div>
                    </div>

                    <div class="am-form-group">
                        <label class="am-u-md-2 am-u-sm-12 am-form-label">匹配类型</label>
                        <div class="am-u-md-10 am-u-sm-12">
                            <label class="am-radio-inline">
                                <!--if{!$info['match']}-->
                                <input name="match" value="0" checked="checked" type="radio">
                                <!--{else}-->
                                <input name="match" value="0" type="radio">
                                <!--{/if}-->
                                精确匹配
                            </label>
                            <label class="am-radio-inline">
                                <!--if{$info['match']}-->
                                <input name="match" checked="checked" value="1" type="radio">
                                <!--{else}-->
                                <input name="match" value="1" type="radio">
                                <!--{/if}-->
                                模糊匹配
                            </label>
                        </div>
                    </div>

                    <div class="am-form-group">
                        <label class="am-u-md-2 am-u-sm-12 am-form-label">图片素材</label>
                        <div class="am-u-md-10 am-u-sm-12">
                            <button class="am-btn am-btn-primary" type="button" data-dux="dialog-open" data-width="700px" data-height="600px" data-url="{url('wechat/MaterialImage/dialog')}" data-title="选择素材"><i class="am-icon-file-image-o"></i> 选择图片素材</button>
                            <p>
                                <!--if{empty($materialInfo.image)}-->
                                <img src="__PUBLIC__/system/images/nopic-150-150.png" alt="" id="image">
                                <!--{else}-->
                                <img src="{$materialInfo.image}" alt="" id="image">
                                <!--{/if}-->
                            </p>
                        </div>
                    </div>

                    <div class="am-form-group">
                        <div class="am-u-sm-offset-12 am-u-md-offset-2">
                            <input type="hidden" name="type" value="image">
                            <input type="hidden" name="media_id" id="media_id" value="{$materialInfo.media_id}">
                            <input type="hidden" name="reply_id" value="{$info.reply_id}">
                            <button class="am-btn am-btn-primary" type="submit" disabled>保存</button>
                        </div>
                    </div>

                </fieldset>
            </form>
        </div>
    </div>
</div>



<script>
    Do('base', function() {
        window.selectImage = function(mediaId, image) {
            $('#image').attr('src', image);
            $('#media_id').val(mediaId);
        }
    });
</script>